# -*-coding:utf-8-*-

# 获取excel数据
import pandas as pd
import requests

data = pd.read_excel('acdata.xlsx')

fastalist = []
for j in data['headers']:
    headers = j.split('|')
    if headers[1] not in fastalist:
        fastalist.append(headers[1])

# print(fastalist)

for code in fastalist:
    url = 'https://www.uniprot.org/uniprot/' + code + '.fasta'
    r = requests.get(url)
    print(r.text)
    f = open(f'fastadata/{code}.fasta', 'w')
    f.write(r.text)
    f.close()
